<?php

/**
 * VehiculoUsuario filter form base class.
 *
 * @package    toyomotor
 * @subpackage filter
 * @author     Ing. Roberto Hernández De La Luz at Netosfera
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseVehiculoUsuarioFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_ano_modelo'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('AnoModelo'), 'add_empty' => true)),
      'kilometraje'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'placa'               => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'id_usuario'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Usuario'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'id_ano_modelo'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('AnoModelo'), 'column' => 'id_ano_modelo')),
      'kilometraje'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'placa'               => new sfValidatorPass(array('required' => false)),
      'id_usuario'          => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Usuario'), 'column' => 'id_usuario')),
    ));

    $this->widgetSchema->setNameFormat('vehiculo_usuario_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'VehiculoUsuario';
  }

  public function getFields()
  {
    return array(
      'id_vehiculo_usuario' => 'Number',
      'id_ano_modelo'       => 'ForeignKey',
      'kilometraje'         => 'Number',
      'placa'               => 'Text',
      'id_usuario'          => 'ForeignKey',
    );
  }
}
